const NewPromise = require('./index')

let promise = new NewPromise((resolve,reject)=>{
  resolve('aaaaaaaaaa')
  // reject('error')
  // throw new Error('1111111111error')
})

// promise.then((value)=>{
//   console.log('1',value)
// },(reason)=>{
//   console.log('xxxx',reason)
// })

let promise1 = promise.then(()=>{
  return new NewPromise((resolve,reject)=>{
    setTimeout(() => {
      reject('error')
    }, 0);
  })
},(reason)=>{
  return reason
})

promise1.then().then().then().then().then((value)=>{
  console.log(value)
},(reason)=>{
  console.log(reason)
}).catch(e=>{
  console.log(e)
})